#include <iostream>
#include <cstring>
#include "Table.h"
#include "Advisor.h"
#include "Client.h"
#define DRAWING_TEST -1 /* Doesn't work yet. */
#if DRAWING_TEST==-1 /* Normal mode. */
  #include "Logic.h"
#else
  class Logic
  {
    private:
      Table* table;
    public:
      void setTable(Table* t){table = t;}
      int getGameWinner(){return DRAWING_TEST;}
      void doTick(){};
  };
#endif


int main(int argc, char* argv[])
{
/* Work paused until basic 1-local, 3-cpu works. */
//  char playerCodes[4][10];
//  /* Default game. */
//  if(argc == 1)
//  {
//    strcpy(playerCodes[0], "local");
//    strcpy(playerCodes[1], "ai");
//    strcpy(playerCodes[2], "ai");
//    strcpy(playerCodes[3], "ai");
//  }

  Table myTable(4);
 
  // Set AIs 
  //Advisor masterAdvisor;
  //myTable.players[1].setAdvisor(&masterAdvisor);
  //myTable.players[2].setAdvisor(&masterAdvisor);
  //myTable.players[3].setAdvisor(&masterAdvisor);

  Logic myLogic;
  myLogic.setTable(&myTable);
  Client firstClient(&myTable);
  
  while(myLogic.getGameWinner() == -1)
  {
    switch(myLogic.getGameWinner())
    {
      case -1:
        // TODO: Update player->setMove
        firstClient.updateClient(&myTable);
	myLogic.doTick();
	cout << "BAM" << endl;
	break;
      case -2:
        cout <<
"After many long years of war, the Czars managed to destroy each other."
        << endl;
	break;
      case 0:
        cout << 
"After years of senseless bloodshed and constant destruction, you have"<<endl<<
"managed to take over Czar-land.  You win a muffin!" << endl;
	cout << "                             ++++                   " << endl;
	cout << "                           ++++                     " << endl;
	cout << "                             ++++                   " << endl;
	cout << "                ^     _---__-__-__--__              " << endl;
	cout << "              <   >_ /................\\             " << endl;
	cout << "               /,......................\\---_        " << endl;
	cout << "              /.............................\\       " << endl;
	cout << "             (...............................\\      " << endl;
	cout << "            {.................................)     " << endl;
	cout << "             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^      " << endl;
	cout << "             |      |         |       |      |      " << endl;
	cout << "             |      |         |       |      |      " << endl;
	cout << "             |      |         |       |      |      " << endl;
	cout << "             |      |         |       |      |      " << endl;
	cout << "             \\      |         |       |      /      " << endl;
	cout << "              |     |         |       |     |       " << endl;
	cout << "              |     |         |       |     |       " << endl;
	cout << "              |_____|_________|_______|_____|       " << endl;
	cout << "                                                    " << endl;
	cout << "                                                    " << endl;
	break;
      default:
        cout <<
"After a few days of vandalism and chaos, another Czar destroyed your" << endl<<
"whole stink'n empire.  After being reduced to being a peasant, you"<<endl<<
"find your calling as an artist and live out the rest of your life"<< endl<<
"in happiness.  You win a bundle of bananas!" << endl;
	cout << "        x                                           " << endl;
	cout << "      xxxxx                                         " << endl;
	cout << "     xxxx\\\\                                       " << endl;
	cout << "    /  x  \\ --___                                  " << endl;
	cout << "   /   /\\ \\      ---------_______                 " << endl;
	cout << "   |   ||\\ \\                     --------_____    " << endl;
	cout << "   |   \\ \\  \\                                 \\ " << endl;
	cout << "   |    \\ \\  -----_                           xx\\" << endl;
	cout << "   |     \\          --_____                  xxxx/ " << endl;
	cout << "   |      \\                ----------------____ /  " << endl;
	cout << "    \\      ----___                             \\  " << endl;
	cout << "     \\            \\                           x\\ " << endl;
	cout << "      \\            ---------_____             xxx/ " << endl;
	cout << "       \\                         -------___     /  " << endl;
	cout << "        -----___                            ---_/   " << endl;
	cout << "                -------______                  x\\  " << endl;
	cout << "                             ------------    __x/   " << endl;
	cout << "                                         ----       " << endl;
	break;
    }
  }
}
